package com.sdx.console.transaction.entity;

import com.ibeetl.admin.core.annotation.Dict;
import com.ibeetl.admin.core.entity.BaseEntity;
import com.sdx.common.utils.EDateUtil;
import lombok.Data;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Date;

/**
 * @ClassName: RefundExport
 * @Description:
 * @author: kangbin
 * @date: 2019/6/17 11:35
 */
@Data
public class RefundExport extends BaseEntity {

    private Long id;

    private String refundId ;

    private String transactionId ;

    private Integer remainMoney ;

    private Integer  refundApply;

    private Date refundTime ;

    private Integer payMethod ;

    private String tradeNo;

    private Date payTime;

    private Date applyTime;

    private String tradeMemo;

    private String merchantNo;

    private String payMethodName;

    private String appId;

    private String merchantId;

    private String orderNo;

    private String consumerId;

    public String  getPayTimeStr(){
        return EDateUtil.getYearMonthDayHMS(payTime);
    }

    public String  getApplyTimeStr(){
        return EDateUtil.getYearMonthDayHMS(applyTime);
    }

    public String  getRemainMoneyStr(){
        BigDecimal bi1 = new BigDecimal(remainMoney);
        BigDecimal bi2 = new BigDecimal(100);
        BigDecimal divide = bi1.divide(bi2, 2, RoundingMode.HALF_UP);
        return divide.toString();
    }

    public String  getRefundApplyTxt(){
        BigDecimal bi1 = new BigDecimal(refundApply);
        BigDecimal bi2 = new BigDecimal(100);
        BigDecimal divide = bi1.divide(bi2, 2, RoundingMode.HALF_UP);
        return divide.toString();
    }

    public String  getPayMethodText(){
        //1、微信h5支付；2、微信公众号支付；3、微信小程序支付；4、微信扫码支付；5、app微信支付；11、支付宝h5支付；12、app支付宝支付；21、一网通h5支付；22、微信内银联支付；23、app银联支付 ；100、免费，31、七天网络支付
        if(payMethod==1){
            return "微信H5";
        }else if(payMethod==2){
            return "公众号";
        }else if(payMethod==3){
            return "小程序";
        }else if(payMethod==4){
            return "微信扫码支付";
        }else if(payMethod==11){
            return "支付宝H5";
        }else if(payMethod==12){
            return "支付宝APP";
        }else if(payMethod==21){
            return "一网通H5";
        }else if(payMethod==22){
            return "微信内银联支付";
        }else if(payMethod==23){
            return "App银联支付";
        }else if(payMethod==31){
            return "七天网络";
        }else if(payMethod==100){
            return "免费";
        }else{
            return "";
        }
    }
}
